package com.sduept.nwld.dataserver.manager.document;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import org.apache.commons.lang3.StringUtils;

import com.sduept.core.dao.SuperDAO;
import com.sduept.nwld.dataserver.model.HtmlDocument;

@Service
public class HtmlDocumentManager {
	
	@Autowired
	private SuperDAO sdao;
	
	/**
	 * 获取所有html model
	 * @return
	 */
	public List<HtmlDocument> findAllHtmlDocuments() {
		return  sdao.findAll(HtmlDocument.class);
	}
	/**
	 * 根据title获取
	 * @return
	 */
	public List<HtmlDocument> findHtmlDocumentsByTitle(String title) {
		List<HtmlDocument> rtn=new ArrayList<>();
		if(StringUtils.isNotEmpty(title)){
			rtn=sdao.findByCondition("title=?", new Object[]{title}, HtmlDocument.class);
		}
		return rtn;
	}
	/**
	 * 更新description
	 * @return
	 */
	public HtmlDocument createOrUpdateHtmlDocument(HtmlDocument hd) {
		return sdao.createOrUpdate(hd, HtmlDocument.class);
	}
	/**
	 * 删除记录
	 * @return 
	 * @return
	 */
	public void delHtmlDocument(HtmlDocument hd) {
		 sdao.delete(hd.getId(), HtmlDocument.class);
	}
	
	

	
}
